<?php $this->load->view($config['site_template'].'/head');?>
<body class="gray-bg">

    <div class="wrapper wrapper-content animated fadeInUp">
        <div class="row">
            <div class="col-sm-12">

                <div class="ibox">
                    <!--
                    <div class="ibox-title">
                        <h5>所有列表</h5>

                        <div class="ibox-tools">
                            <a href="projects.html" class="btn btn-primary btn-xs">创建新项目</a>
                        </div>

                    </div>
                    -->
                    <div class="ibox-content">

                        <div class="row m-b-sm m-t-sm">
                            <div class="col-md-1">
                                <button type="button" id="loading-example-btn" class="btn btn-white btn-sm"><i class="fa fa-refresh"></i> 刷新</button>
                            </div>
                            <div class="col-md-11">
                                <div class="form-inline">
<!--                                    <input type="text" placeholder="请输入异常问题描述" class="input-sm form-control"> -->
                                    <select class="input-sm form-control" id="productLineSerach" data-style="btn-primary" data-width="40%" title="请选择生产线名称">
                                        <option data-hidden="true" value="" disable>---请选择生产线名称---</option>
                                        <?php foreach ($lineData as $value):?>
                                            <option value="<?=$value['lineId']?>" <?= ($value['lineId'] === $productLine) ? "selected" : ""?>><?=$value['lineName']?></option>
                                        <?php endforeach;?>
                                    </select>
                                    <select class="input-sm form-control" id="classesSearch" data-style="btn-primary" data-width="40%" title="请选择班次">
                                        <option data-hidden="true" value="" disable>---请选择班次---</option>
                                        <?php foreach ($classesData as $value):?>
                                            <option value="<?=$value['val']?>" <?= ($value['val'] === $classes) ? "selected" : ""?>><?=$value['valName']?></option>
                                        <?php endforeach;?>
                                    </select>
<!--                                    <span class="input-group-btn">-->
                                        <button type="button" id="serachBtn" class="btn btn-sm btn-primary"> 搜索</button>
<!--                                    </span>-->
                                </div>
                            </div>
                        </div>

                        <div class="project-list">

                            <table class="table table-hover">
                                <tbody>
                                    <tr>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">序号</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">填写人</a>
                                        </td>
<!--                                        <td class="project-title">-->
<!--                                            <a href="javascript:void(0)">所在部门</a>-->
<!--                                        </td>-->
                                        <td class="project-title">
                                            <a href="javascript:void(0)">填写时间</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">生产线名称</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">班次</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">地面、墙角、墙边是否除铁</a>
                                        </td>
<!--                                        <td class="project-title">-->
<!--                                            <a href="javascript:void(0)">墙角、墙边除铁确认</a>-->
<!--                                        </td>-->
                                        <td class="project-title">
                                            <a href="javascript:void(0)">工具箱、搬运工具是否除铁</a>
                                        </td>
<!--                                        <td class="project-title">-->
<!--                                            <a href="javascript:void(0)">搬运工具除铁确认</a>-->
<!--                                        </td>-->
                                        <td class="project-title">
                                            <a href="javascript:void(0)">操作平台是否除铁</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">除铁器异物是否清理</a>
                                        </td>
<!--                                        <td class="project-title">-->
<!--                                            <a href="javascript:void(0)">环境除铁照片</a>-->
<!--                                        </td>-->
                                        <td class="project-title" style="text-align: right;">
                                            <a href="javascript:void(0)">操作</a>
                                        </td>
                                    </tr>
                                    <?php foreach ($list as $value):?>
                                    <tr>
                                        <td class="project-status">
                                            <span class="label label-primary"><?=$value['lid']?>
                                        </td>
                                        <td class="project">
                                            <?=$value['userName']?>
                                        </td>
<!--                                        <td class="project">-->
<!--                                            --><?//=$value['userDeptName']?>
<!--                                        </td>-->
                                        <td class="project">
                                            <?=date('Y-m-d H:i:s',$value['createTime'])?>
                                        </td>
                                        <td class="project">
                                            <?=$value['productLine']?>
                                        </td>
                                        <td class="project">
                                            <?=$value['classes'] == 0 ? "夜班" : "白班"?>
                                        </td>
                                        <td class="project">
                                            <?=$value['isGroundRemoveIron'] == 0 ? "否" : "是"?>
                                        </td>
<!--                                        <td class="project">-->
<!--                                            --><?//=$value['isCornernRemoveIron'] == 0 ? "否" : "是"?>
<!--                                        </td>-->
                                        <td class="project">
                                            <?=$value['isToolCaseRemoveIron'] == 0 ? "否" : "是"?>
                                        </td>
<!--                                        <td class="project">-->
<!--                                            --><?//=$value['isCarryToolRemoveIron'] == 0 ? "否" : "是"?>
<!--                                        </td>-->
                                        <td class="project">
                                            <?=$value['isOperatingPlatformRemoveIron'] == 0 ? "否" : "是"?>
                                        </td>
                                        <td class="project">
                                            <?=$value['isOtherRemoveIron'] == 0 ? "否" : "是"?>
                                        </td>
<!--                                        <td class="social-avatar">-->
<!--                                            <a href="javascript:void(0)">-->
<!--                                                --><?php //if(strlen($value['envRemoveIronImgSrc'])  > 0):?>
<!--                                                <img alt="image" class="img" id="envRemoveIronImgSrc" src="--><?//=  base_url().$value['envRemoveIronImgSrc']?><!--">-->
<!--                                                --><?php //endif;?>
<!--                                            </a>-->
<!--                                        </td>-->
                                        <td class="project-actions">
                                            <a href="javascript:void(0)" class="btn btn-white btn-sm showOrder"><input type="hidden" name="id" value="<?=$value['id']?>"><i class="fa fa-folder"></i> 查看 </a>
                                            <!--<a href="projects.html#" class="btn btn-white btn-sm"><i class="fa fa-pencil"></i> 编辑 </a>-->
                                        </td>
                                    </tr>
                                    <?php endforeach;?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <script>
       $(document).ready(function() {
            $("#loading-example-btn").click(function() {
                btn = $(this);
                simpleLoad(btn, true);
                simpleLoad(btn, false)
                var productLineSerach = $("#productLineSerach option:selected").val();
                var classesSearch = $("#classesSearch option:selected").val();
                window.location.href = "<?=base_url('XunJian_YiPei/dataAllList_HJCTJLB?productLine=')?>" + productLineSerach + "&classes=" + classesSearch;
            })
            $('.img').click(function(){
                var src = $(this).attr("src")
                var id = $(this).attr("id");
                var showText;
                // if(id == "toolCaseImgSrc"){
                //     showText = "工具箱照片";
                // }
                $(".showText").text(showText);
                $("#thumb").attr('src',src);
                $(".showThumb").click();
            });
            $("#serachBtn").click(function () {
                var productLineSerach = $("#productLineSerach option:selected").val();
                var classesSearch = $("#classesSearch option:selected").val();
                window.location.href = "<?=base_url('XunJian_YiPei/dataAllList_HJCTJLB?productLine=')?>" + productLineSerach + "&classes=" + classesSearch;
            });
            $(".showOrder").click(function(){
                var id = $(this).find("[name=id]").val();
                $.ajax({
                    type:"GET",
                    url:'<?=base_url("XunJian_YiPei/getSingleContent_HJCTJLB?id=")?>'+id,
                    dataType: "json",
                    success:function(data){
                        if(data.userName.length > 0){
                            $("#userName").html(data.userName);
                        }else{
                            $("#userName").html("无数据");
                        }
                        // if(data.userDeptName.length > 0){
                        //     $("#userDeptName").html(data.userDeptName);
                        // }else{
                        //     $("#userDeptName").html("无数据");
                        // }
                        if(data.createTime.length > 0){
                            $("#createTime").html(data.createTime);
                        }else{
                            $("#createTime").html("无数据");
                        }
                        if(data.productLine.length > 0){
                            $("#productLine").html(data.productLine);
                        }else{
                            $("#productLine").html("无数据");
                        }
                        if(data.classes.length > 0){
                            var classes;
                            if(data.classes == 0){
                                classes = "夜班";
                            }else if(data.classes == 1){
                                classes = "白班";
                            }
                            $("#classes").html(classes);
                        }else{
                            $("#classes").html("无数据");
                        }
                        if(data.isGroundRemoveIron.length > 0){
                            var isGroundRemoveIron;
                            if(data.isGroundRemoveIron == 0){
                                isGroundRemoveIron = "否";
                            }else if(data.isGroundRemoveIron == 1){
                                isGroundRemoveIron = "是";
                            }
                            $("#isGroundRemoveIron").html(isGroundRemoveIron);
                        }else{
                            $("#isGroundRemoveIron").html("无数据");
                        }
                        // if(data.isCornernRemoveIron.length > 0){
                        //     var isCornernRemoveIron;
                        //     if(data.isCornernRemoveIron == 0){
                        //         isCornernRemoveIron = "否";
                        //     }else if(data.isCornernRemoveIron == 1){
                        //         isCornernRemoveIron = "是";
                        //     }
                        //     $("#isCornernRemoveIron").html(isCornernRemoveIron);
                        // }else{
                        //     $("#isCornernRemoveIron").html("无数据");
                        // }
                        if(data.isToolCaseRemoveIron.length > 0){
                            var isToolCaseRemoveIron;
                            if(data.isToolCaseRemoveIron == 0){
                                isToolCaseRemoveIron = "否";
                            }else if(data.isToolCaseRemoveIron == 1){
                                isToolCaseRemoveIron = "是";
                            }
                            $("#isToolCaseRemoveIron").html(isToolCaseRemoveIron);
                        }else{
                            $("#isToolCaseRemoveIron").html("无数据");
                        }
                        // if(data.isCarryToolRemoveIron.length > 0){
                        //     var isCarryToolRemoveIron;
                        //     if(data.isCarryToolRemoveIron == 0){
                        //         isCarryToolRemoveIron = "否";
                        //     }else if(data.isCarryToolRemoveIron == 1){
                        //         isCarryToolRemoveIron = "是";
                        //     }
                        //     $("#isCarryToolRemoveIron").html(isCarryToolRemoveIron);
                        // }else{
                        //     $("#isCarryToolRemoveIron").html("无数据");
                        // }
                        if(data.isOperatingPlatformRemoveIron.length > 0){
                            var isOperatingPlatformRemoveIron;
                            if(data.isOperatingPlatformRemoveIron == 0){
                                isOperatingPlatformRemoveIron = "否";
                            }else if(data.isOperatingPlatformRemoveIron == 1){
                                isOperatingPlatformRemoveIron = "是";
                            }
                            $("#isOperatingPlatformRemoveIron").html(isOperatingPlatformRemoveIron);
                        }else{
                            $("#isOperatingPlatformRemoveIron").html("无数据");
                        }
                        if(data.isOtherRemoveIron.length > 0){
                            var isOtherRemoveIron;
                            if(data.isOtherRemoveIron == 0){
                                isOtherRemoveIron = "否";
                            }else if(data.isOtherRemoveIron == 1){
                                isOtherRemoveIron = "是";
                            }
                            $("#isOtherRemoveIron").html(isOtherRemoveIron);
                        }else{
                            $("#isOtherRemoveIron").html("无数据");
                        }
                        //if(data.envRemoveIronImgSrc.length > 0){
                        //    $("#envRemoveIronImgSrc").html('<img src="<?//=  base_url()?>//'+data.envRemoveIronImgSrc+'" class="img-responsive" alt="Cinque Terre">');
                        //}else{
                        //    $("#envRemoveIronImgSrc").html("无数据");
                        //}
                        $(".showAbnormalQas").click();
                    }
                    
                })
            })
        });

        function simpleLoad(btn, state) {
            if (state) {
                btn.children().addClass("fa-spin");
                btn.contents().last().replaceWith(" Loading")
            } else {
                setTimeout(function() {
                    btn.children().removeClass("fa-spin");
                    btn.contents().last().replaceWith(" Refresh")
                },
                2000)
            }
        };
    
        $(function () { $('#imgShow').modal('hide')});
        $(function () { $('#imgShow').on('hide.bs.modal', function () {
           //alert('嘿，我听说您喜欢模态框...');
           })
        });
    </script>
    
    </body>
    <!--异常问题截图展示-->
    <!-- 按钮触发模态框 -->
    <button class="btn btn-primary btn-lg showThumb" style="display: none" data-toggle="modal" data-target="#imgShow">
            演示图片模态框
    </button>
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="imgShow" tabindex="-1" role="dialog" aria-labelledby="imgShowLabel" aria-hidden="true">
            <div class="modal-dialog">
                    <div class="modal-content">
                            <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
                                    </button>
                                    <h4 class="modal-title" id="imgShowLabel">
                                        <div class="showText">异常问题截图</div>
                                    </h4>
                            </div>
                            <div class="modal-body">
                                    <img id="thumb" src="" class="img-responsive" alt="Cinque Terre"> 
                            </div>
                            <div class="modal-footer">
                                    <button type="button" class="btn btn-primary" data-dismiss="modal">
                                            关闭
                                    </button>
                            </div>
                    </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
    
    <!--异常问题详细内容展示-->
    <!-- 按钮触发模态框 -->
    <button class="btn btn-primary btn-lg showAbnormalQas" style="display: none" data-toggle="modal" data-target="#AbnormalQasShow">
            异常问题详细模态框
    </button>
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="AbnormalQasShow" tabindex="-1" role="dialog" aria-labelledby="AbnormalQasShowLabel" aria-hidden="true">
            <div class="modal-dialog">
                    <div class="modal-content">
                            <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
                                    </button>
                                    <h4 class="modal-title" id="AbnormalQasShowLabel">
                                        环境除铁记录表
                                    </h4>
                            </div>
                            <div class="modal-body">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label well well-sm">填写人</label>
                                    <div id="userName" class="col-sm-8 well well-sm">
                                    </div>
                                </div>
<!--                                <div class="form-group">-->
<!--                                    <label class="col-sm-4 control-label well well-sm">所在部门</label>-->
<!--                                    <div id="userDeptName" class="col-sm-8 well well-sm">-->
<!--                                    </div>-->
<!--                                </div>-->
                                <div class="form-group">
                                    <label class="col-sm-4 control-label well well-sm">填写时间</label>
                                    <div id="createTime" class="col-sm-8 well well-sm">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-4 control-label well well-sm">生产线名称</label>
                                    <div id="productLine" class="col-sm-8 well well-sm">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-4 control-label well well-sm">班次</label>
                                    <div id="classes" class="col-sm-8 well well-sm">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-4 control-label well well-sm">地面、墙角、墙边是否除铁</label>
                                    <div id="isGroundRemoveIron" class="col-sm-8 well well-sm">
                                    </div>
                                </div>
<!--                                <div class="form-group">-->
<!--                                    <label class="col-sm-4 control-label well well-sm">墙角、墙边除铁确认</label>-->
<!--                                    <div id="isCornernRemoveIron" class="col-sm-8 well well-sm">-->
<!--                                    </div>-->
<!--                                </div>-->
                                <div class="form-group">
                                    <label class="col-sm-4 control-label well well-sm">工具箱、搬运工具是否除铁</label>
                                    <div id="isToolCaseRemoveIron" class="col-sm-8 well well-sm">
                                    </div>
                                </div>
<!--                                <div class="form-group">-->
<!--                                    <label class="col-sm-4 control-label well well-sm">搬运工具除铁确认</label>-->
<!--                                    <div id="isCarryToolRemoveIron" class="col-sm-8 well well-sm">-->
<!--                                    </div>-->
<!--                                </div>-->
                                <div class="form-group">
                                    <label class="col-sm-4 control-label well well-sm">操作平台是否除铁</label>
                                    <div id="isOperatingPlatformRemoveIron" class="col-sm-8 well well-sm">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-4 control-label well well-sm">除铁器异物是否清理</label>
                                    <div id="isOtherRemoveIron" class="col-sm-8 well well-sm">
                                    </div>
                                </div>

<!--                                <div class="form-group">-->
<!--                                    <label class="col-sm-4 control-label well well-sm">环境除铁照片</label>-->
<!--                                    <div id="envRemoveIronImgSrc" class="col-sm-8 well well-sm">11</div>-->
<!--                                </div>-->
                            </div>
                            <div class="modal-footer">
                                    <button type="button" class="btn btn-primary" data-dismiss="modal">
                                            关闭
                                    </button>
                            </div>
                    </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
<?php $this->load->view($config['site_template'].'/foot');?>